Skip to content

feat: gitignore .mcp.json on cce init#73

Merged
rajkumarsakthivel merged 1 commit into
mainfrom
feat/gitignore-mcp-json
May 12, 2026
Merged

feat: gitignore .mcp.json on cce init#73
rajkumarsakthivel merged 1 commit into
mainfrom
feat/gitignore-mcp-json

Conversation

@fazleelahhee
Copy link
Copy Markdown
Contributor

Summary

`.mcp.json` carries an absolute path to the `cce` binary and a
`--project-dir` argument — both differ on every contributor's
machine. Committing it forces everyone to share one path layout, which
never holds in practice (homedir paths, pipx vs uv vs pip installs,
etc.).

`cce init` regenerates `.mcp.json` on every machine, so the right
default is to keep it out of version control alongside the other
per-machine entries (`.cce/`, `.claude/settings.local.json`).

Behaviour

  • Newly-init'd projects get `.mcp.json` in the managed CCE block of
    `.gitignore`.
  • Existing projects pick up the new entry on the next `cce init`
    (`ensure_gitignore` is idempotent — it only appends missing
    entries, never rewrites unrelated content).
  • Projects that already explicitly listed `.mcp.json` don't get a
    duplicate.
  • Existing tracked `.mcp.json` files are not auto-untracked;
    that's a manual `git rm --cached` decision the user makes.

Tests

  • `test_ignores_mcp_json`: `ensure_gitignore` writes `.mcp.json`
    into a fresh `.gitignore`.
  • `test_mcp_json_not_duplicated_if_user_already_ignored`:
    pre-existing entry is preserved without duplication.

Verification

  • `pytest tests/test_project_commands.py` → 60 passed
  • `ruff check` → clean

Test plan

  • `cce init` on a fresh repo — `.mcp.json` appears in
    `.gitignore` under the CCE-managed block
  • `cce init` on an existing repo that already has
    `.mcp.json` listed — no duplicate entry
  • `cce init` on a repo with a previously-tracked
    `.mcp.json` — file stays tracked (the user-driven
    `git rm --cached .mcp.json` step is intentional)

.mcp.json carries an absolute path to the cce binary and a
project_dir argument — both differ on every contributor's machine.
Committing it forces everyone to share one path layout, which never
holds in practice (homedir paths, pipx vs uv vs pip installs, etc.).

`cce init` regenerates .mcp.json on every machine, so the right
default is to keep it out of version control alongside the other
per-machine entries (.cce/, .claude/settings.local.json).

Behaviour:
  - Newly-init'd projects get .mcp.json in the managed CCE block of
    .gitignore.
  - Existing projects pick up the new entry on the next `cce init`
    (ensure_gitignore is idempotent and only appends missing
    entries — it never rewrites unrelated content).
  - Projects that already explicitly listed .mcp.json don't get a
    duplicate.
  - Existing tracked .mcp.json files are not auto-untracked; that's
    a manual `git rm --cached` decision the user makes.

Tests added:
  - test_ignores_mcp_json: ensure_gitignore writes .mcp.json into a
    fresh .gitignore.
  - test_mcp_json_not_duplicated_if_user_already_ignored:
    pre-existing entry is preserved without duplication.
Copy link
Copy Markdown
Member

@rajkumarsakthivel rajkumarsakthivel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Correct change, well-scoped.

.mcp.json has absolute paths that differ per machine, and cce init regenerates it. Gitignoring it is the right default. Tests cover both the fresh write and the dedup case. No breaking change for repos that already track it.

@rajkumarsakthivel rajkumarsakthivel merged commit a2ab6f6 into main May 12, 2026
10 checks passed
@rajkumarsakthivel rajkumarsakthivel deleted the feat/gitignore-mcp-json branch May 12, 2026 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants